package com.atguigu.jdbc3;

import com.atguigu.jdbc.JDBCUtils;
import org.junit.Test;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

public class StatmentTest {
    @Test
    public void test() throws SQLException {
        Scanner scan = new Scanner(System.in);
        System.out.print("用户名：");
        String userName = scan.nextLine();
        System.out.print("密   码：");
        String password = scan.nextLine();

        //SELECT id,name FROM emp WHERE id='12332' OR 1='1' AND name='123321' OR 1='1'
//        String sql = "select id,username from temp where id = '"
//                + userName + "' and username = '" + password + "'";
//
//        System.out.println(sql);
//
//        Connection connection = JDBCUtils.getConnection();
//        Statement statement = connection.createStatement();
//        //执行sql语句
//        ResultSet rs = statement.executeQuery(sql);
//        while(rs.next()){
//            System.out.println(rs.getString("id"));
//            System.out.println(rs.getString("name"));
//        }
//        //关闭资源
//        rs.close();
//        connection.close();
    }
}
